package com.hson.demo.base.util.web;

public class MathUtil {
	public static <T> int getLevelNoLT(T array[], T value) {
		int i = 0;
		for(; i < array.length; i++) {
			if(value instanceof Integer) {
				if((Integer)value < (Integer)array[i]) {
					break;
				}
			} else if(value instanceof Float) {
				if((Float)value < (Float)array[i]) {
					break;
				}
			}
		}		
		return i;
	}	
	
	
	public static <T> int getLevelNoLE(T array[], T value) {
		int i = 0;
		for(; i < array.length; i++) {
			if(value instanceof Integer) {
				if((Integer)value <= (Integer)array[i]) {
					break;
				}
			} else if(value instanceof Float) {
				if((Float)value <= (Float)array[i]) {
					break;
				}
			}
		}		
		return i;
	}


	 
}
